package cn.mumzone.pos.util.jpush;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import cn.jpush.android.api.CustomMessage;
import cn.jpush.android.api.JPushInterface;
import cn.jpush.android.api.JPushMessage;
import cn.jpush.android.service.JPushMessageReceiver;
import cn.mumzone.basic.util.RxBus;
import cn.mumzone.basic.util.log.Elog;
import cn.mumzone.pos.event.JPushEvent;
import cn.mumzone.pos.ui.activity.ACT_Home;

/**
 * Created by qiuzhenhuan on 2019/7/12.
 */

public class MyJPushMessageReceiver extends JPushMessageReceiver {

    private static final String TAG = "JPush";

    @Override
    public void onTagOperatorResult(Context context, JPushMessage jPushMessage) {
        super.onTagOperatorResult(context, jPushMessage);
    }

    @Override
    public void onCheckTagOperatorResult(Context context, JPushMessage jPushMessage) {
        super.onCheckTagOperatorResult(context, jPushMessage);
    }

    @Override
    public void onAliasOperatorResult(Context context, JPushMessage jPushMessage) {
        Elog.e(TAG, "别名设置 alias ： " + jPushMessage.getAlias() + " errorCode : "+ jPushMessage.getErrorCode());
        super.onAliasOperatorResult(context, jPushMessage);
    }

    @Override
    public void onMobileNumberOperatorResult(Context context, JPushMessage jPushMessage) {
        super.onMobileNumberOperatorResult(context, jPushMessage);
    }

    @Override
    public void onMessage(Context context, CustomMessage customMessage) {
        Elog.e(TAG, "收到极光消息 : " + customMessage.message);
        RxBus.getDefault().post(new JPushEvent(JPushEvent.EVENT_NEW_PUSH_MSG));
    }

    @Override
    public void onConnected(Context context, boolean connected) {
        Elog.e(TAG, connected ? "JPUSH 已连接" : "JPUSH 已断开");
    }
}

